package com.bifang.module.file.common.enums;

/**
 * 文件请求类型
 *
 * @author chenzh
 * @date 2019-08-12
 */
public enum FileReqTypeEnum {
    UPLOAD("upload", "上传"),
    DOWNLOAD("download", "下载"),
    DELETE("delete", "删除"),
    IMGCOMPRESS("imgComp", "图片压缩"),
    SHOW("show", "查看");
    private String type;
    private String name;

    FileReqTypeEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return this.type;
    }

    public String getName() {
        return this.name;
    }

    public static FileReqTypeEnum getByType(String type) {

        for (FileReqTypeEnum typeEnum : values()) {
            if (typeEnum.getType() == type) {
                return typeEnum;
            }
        }
        return null;
    }
}
